{extend name="template"}

{block name="body"}


<!-- 导航栏 -->
<div class="layui-row common-nav" style="width:100%;position:fixed;top:0;left:0;height:100px;z-index:90;">
    {include file="common/header" /}
</div>
<div id="search_form" style="display: none;z-index:1000;position:absolute;">
    {include file="common/search" /}
</div>

<!-- 轮播图 -->
<div class="layui-row list-carousel" style="position:fixed;top:100px;width:100%;left:0;right:0;height:250px;z-index:80;">
    <div style="width:100%;max-width:1920px;margin:0 auto;">
        <img style="width:100%;height:100%;"  src="__ROOT__/static/index/img/subbanner_03.jpg">
    </div>
</div>

<div class="gas-index layui-fluid" style="width:100%;padding:10px 0 0;background-color:#f7f6f4;position:relative;margin-top:360px;z-index:110;">

    <div class="list-content layui-row margin-top-20">
        <div class="index-content">
            <div class="gas-left-nav pull-left">
                <ul class="nav-list">
                    <li class="header">
                        <span class="head-icon padding-right-5 fa fa-bell"></span>{$policy.info.title}
                        <div class="triangle-left"></div>
                    </li>
                    {foreach $policy.category as $key=>$vo}
                    {if $vo.id eq $policy.selected.id}
                    <li class="selected item">
                        <span class="nav-icon padding-right-5 fa fa-circle-o"></span>
                        <a style="color:inherit;" href="/policy.html?id={$vo.id}">{$vo.title}</a>
                    </li>
                    {else}
                    <li class="item">
                        <span class="nav-icon padding-right-5 fa fa-circle-o"></span>
                        <a style="color:inherit;" href="/policy.html?id={$vo.id}">{$vo.title}</a>
                    </li>
                    {/if}
                    {/foreach}
                </ul>
            </div>
            <div class="list" style="width:900px">
                <div class="header" style="height:30px;">
                    <div class="pull-left name">{$policy.selected.title}</div>
                    <div class="pull-right breadcrumb">
                        <a style="color: inherit;" href="/">首页</a>->{$policy.info.title}->{$policy.selected.title}
                    </div>
                    <div class="pull-right search" style="margin-right:30px;">
                        <form name="search" method="get" action="">
                            <input name="page" type="hidden" value="{$page}" />
                            <input name="id" type="hidden" value="{$id}" />
                            <input name="kw" value="{$kw}" type="text" class="input-normal" placeholder="请输入搜索关键字" />
                            <button type="submit" class="button-normal">搜索</button>
                        </form>
                    </div>
                </div>

                <div class="body-info">
                    {foreach $policy.list as $key=>$vo}
                    <dl>
                        <dt class="pull-left">
                            <div class="top"></div>
                            <div class="date">
                                <p class="day">{$vo.create_at|format_datetime='d'}</p>
                                <p>{$vo.create_at|format_datetime='Y-m'}</p>
                            </div>
                        </dt>
                        <dd class="pull-left" style="width:760px;">
                            <p class="title">
                                <a href="/policy/detail.html?id={$vo.id}">{$vo.title}</a>
                            </p>
                            <p class="abstract">
                                {$vo.digest|mb_substr=0,180,'utf-8'}
                            </p>
                        </dd>
                    </dl>
                    {/foreach}
                    {if count($policy.list) eq 0 }
                        <div class="no-data">没有数据</div>
                    {/if}
                </div>
                {if count($policy.list) gt 0 }
                    <div class="paging" id="test1"></div>
                {/if}
            </div>
        </div>
    </div>

    {include file="common/footer" /}

</div>

{/block}

{block name='style'}
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<script>if (location.href.indexOf('#') > -1) location.replace(location.href.split('#')[0])</script>
<link rel="stylesheet" href="__ROOT__/static/index/index.css">
{/block}

{block name='script'}
<script src="__ROOT__/static/index/index.js"></script>

<script>
    window.$= layui.$;
    layui.use('laypage', function(){
        var laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'test1' //注意，这里的 test1 是 ID，不用加 # 号
            ,count: '{$policy.pager.total}' //数据总数，从服务端得到
            ,limit:'{$policy.pager.limit}'
            ,curr:'{$policy.pager.page}'
        });
        $(".paging a").click(function () {
            let curr = $(this).attr("data-page");
            let kw = $("input[name=kw]").val();
            location.href='/policy.html?kw='+kw+'&page='+curr;
        });
    });

    window.$= layui.$;
    layui.use('laypage', function(){
        var laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'test1' //注意，这里的 test1 是 ID，不用加 # 号
            ,count: '{$policy.pager.total}' //数据总数，从服务端得到
            ,limit:'{$policy.pager.limit}'
            ,curr:'{$policy.pager.page}'
        });
        $(".paging a").click(function () {
            var curr = $(this).attr("data-page");
            location.href='/policy/index.html?id={$policy.selected.id}page='+curr;

        });
    });
</script>
{/block}
